/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package modele;

import java.util.*;

/**
 *
 * @author sio
 */
public class Pays {

    Collection<Dep> lesDeps;
    Collection<Spe> lesSpes;

    public Pays() {
        lesDeps = DAO.getLesDeps();
        lesSpes = DAO.getLesSpes();
        Collection<Med> lesMeds = DAO.getLesMeds();
        for (Med unMed : lesMeds) {
            for (Dep unDep : lesDeps) {
                String dep = unDep.getNum();
                if (unMed.getDepartement().equals(dep)) {
                    unDep.addMed(unMed);
                    break;
                }

            }
            for (Spe uneSpe : lesSpes) {
                String spe = uneSpe.getNom();
                if (spe.equals(unMed.getSpe())) {
                    uneSpe.addMed(unMed);
                    break;
                }
            }
        }
    }

    public Collection getLesDeps() {
        return lesDeps;
    }

    public Dep getLeDep(String numDep) {
        for (Dep leDep : lesDeps) {
            if (leDep.getNum().equals(numDep)) {

                return leDep;
            }
        }
        return null;

    }
       public Collection getLesSpes() {
        return lesSpes;
    }

    public Spe getLaSpe(String nomSpe) {
        for (Spe laSpe:lesSpes) {
            if (laSpe.getNom().equals(nomSpe)) {

                return laSpe;
            }
        }
        return null;

    } 
    
}
